#ifndef _APP_CYCLE_QUEUE_H_
#define _APP_CYCLE_QUEUE_H_

#include <pthread.h>

#pragma pack(1)
typedef struct _APP_CYCLE_QUEUE_s_ 
{
	UINT8 *pu8Base;		
	UINT16 u16Front;              //cycle queue head
	UINT16 u16Rear;               //cycle queue tail
	UINT16 u16Queuesize;            //cycle max size
	UINT16 u16ItemSize;            //cycle element size

    pthread_rwlock_t stMtx;
}APP_CYCLE_QUEUE_s;
#pragma pack()

extern ULONG AppCycleQueue_Create(IN UINT16 u16ItemSize, IN UINT16 u16Queuesize, INOUT APP_CYCLE_QUEUE_s *pstQ);
extern BOOL AppCycleQueue_IsFull(IN APP_CYCLE_QUEUE_s *pstQ);
extern BOOL AppCycleQueue_IsEmpty(IN APP_CYCLE_QUEUE_s *pstQ);
extern ULONG AppCycleQueue_Enqueue(IN APP_CYCLE_QUEUE_s *pstQ, IN UINT8 *pu8Val, IN UINT16 u16len);
extern ULONG AppCycleQueue_Dequeue(IN APP_CYCLE_QUEUE_s *pstQ, INOUT UINT8 *pu8Val, IN UINT16 u16Len);
extern void AppCycleQueue_Destory(INOUT APP_CYCLE_QUEUE_s *pstQ);

#endif
